<script type="text/javascript">
<!--
function categoryUpdate(){
    
    if($("#Category_cate_name").val()==''){                
        
        $.msgbox({
            width:250,
            height:100,
            content:{type:'alert', content:'分类名称不能为空'},
            animation:4
        });   
    }else{

//    	var url = '<?php echo $this->createUrl('category'); ?>';
		var url = location.href;
//		alert(url);

//		alert(url+$("#Category_cate_des").val());
		
    	var data = {
			'Category[cate_name]':$("#Category_cate_name").val(),
			'Category[cate_pid]':$("#Category_cate_pid").val(),
			'Category[cate_type]':'<?php echo $model->cate_type; ?>',
			'Category[cate_order]':$("#Category_cate_order").val()==''?500:$("#Category_cate_order").val(),
    		'Category[cate_des]':$("#Category_cate_des").val()==''?'无':$("#Category_cate_des").val(),
    		'Category[cate_recommend]':$("#Category_cate_recommend").val(),
    		'Category[cate_contype]':$("#Category_cate_contype").val(),
    		'Category[cate_link]':$("#Category_cate_link").val(),
    		'self':1
    	};            	

        
		$.post(url,data,function(msg){
                if(msg == "fail"){
                    message = "增加分类失败！";
                }else if(msg == "exists"){
                    message = "该分类已经存在！";
                }else{
					message = "分类信息更新成功！";
//					message = msg;
                }            


				$.msgbox({
					height:100,
	                width:250,
	                content:{type:'alert', content: message},
	                animation:4
	            });		
		});
      
    }    
    
    return false;	
}


//-->
</script>
<?php echo $this->renderPartial('_formupdate', array('model'=>$model)); ?>





